package com.wcr.edu.info.manager.service;

import com.wcr.edu.info.manager.dao.TeacherDao;
import com.wcr.edu.info.manager.domain.Teacher;

public class TeacherService {
   TeacherDao teacherDao = new TeacherDao();


    //添加方法(业务员)
    public boolean addS(Teacher student) {
        //收到客服上传的录入数据,传递给库管,让他上传
        boolean add = teacherDao.addDao(student);
        return add;
    }

    //查看方法(业务员)
    public Teacher[] ckTeacher() {
        boolean b = false;
        Teacher[] teacher = teacherDao.ckTeacher();
        for (int i = 0; i < teacher.length; i++) {
            Teacher student = teacher[i];
            if (student != null) {
                b = true;
                break;
            }
        }
        if (b) {
            return teacher;
        } else {
            return null;
        }
    }


    //判断老师学号是否存在
    public boolean isId(String id) {
        boolean is = false;
        Teacher[] teacher = teacherDao.ckTeacher();
        for (int i = 0; i < teacher.length; i++) {
            Teacher teachers = teacher[i];
            if (teachers != null && teachers.getId().equals(id)) {
                is = true;
                break;
            }
        }
        return is;
    }

    //修改老师方法(业务员)
    public boolean xiugai(String newid, Teacher newstudent) {
        return teacherDao.xiugai(newid, newstudent);

    }

    //删除老师方法(业务员)
    public void shanChuId(String shanChuId) {
        teacherDao.shanChuId(shanChuId);

    }
}


